/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PacientPanel.java
 *
 * Created on 09.05.2009, 14:11:28
 */

package ru.vsu.cs.piit.vokod.view.panels;

import datechooser.events.CommitEvent;
import datechooser.events.CommitListener;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.Date;
import java.util.Vector;
import javax.swing.ComboBoxModel;
import javax.swing.InputVerifier;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JTextField;
import javax.swing.border.LineBorder;
import ru.vsu.cs.piit.vokod.IListListener;
import ru.vsu.cs.piit.vokod.IListListener;
import ru.vsu.cs.piit.vokod.ObservableArrayList;
import ru.vsu.cs.piit.vokod.TableModels.CBModel;
import ru.vsu.cs.piit.vokod.Utils;
import ru.vsu.cs.piit.vokod.controller.Controller;
import ru.vsu.cs.piit.vokod.controller.Maps;
import ru.vsu.cs.piit.vokod.model.*;

/**
 *
 * @author Галчонок
 */
public class PacientPanel extends javax.swing.JPanel {

    Pacient pacient = new Pacient();

    public PacientPanel() {
        initComponents();
        InputVerifier verifier = new InputVerifier() {
          public boolean verify(JComponent comp) {
            boolean returnValue;
            JTextField textField = (JTextField) comp;
            if (textField.getText().compareTo("")!=0)
                try {
                  Integer.parseInt(textField.getText());
                  textField.setBorder(new LineBorder(Color.BLACK, 1));
                  returnValue = true;
                } catch (NumberFormatException e) {
                    textField.setBorder(new LineBorder(Color.RED, 1));
                    returnValue = false;
                }
            else returnValue = true;
            return returnValue;
          }
        };

        tbBedDays.setInputVerifier(verifier);
        tbDaysBeforeTretament.setInputVerifier(verifier);

        this.setSize(this.getPreferredSize());
        AddActions();
        setValues();
    }

    public PacientPanel(Pacient pacient) {
        this();
        this.pacient = pacient;
        setValues();
    }

    private void setValues()
    {
        this.chDateComing.getCurrent().setTime(pacient.getDateOfComing());
        this.chDateDischarge.getCurrent().setTime(pacient.getDateOfDischarge());
        this.cbDiagnos.getModel().setSelectedItem(pacient.getDiagnos());
        this.cbMoveFrom.getModel().setSelectedItem(pacient.getMoveFrom());
        this.cbMoveTo.getModel().setSelectedItem(pacient.getMoveTo());
        this.cbTreatment.getModel().setSelectedItem(pacient.getTreatment());
        this.cbWard.getModel().setSelectedItem(pacient.getWard());
        if (pacient.getComplex() == null) pacient.setComplex(false);
        this.chbComplex.setSelected(false);
        if (pacient.getDied()==null) pacient.setDied(false);
        this.chbDied.setSelected(pacient.getDied());
        if ((pacient.getDateOfComing()!=null)&&(pacient.getDateOfDischarge()!=null))
            this.lbBedDays.setText(Utils.getDays(pacient.getDateOfComing(), pacient.getDateOfDischarge()).toString());
        if (pacient.getDiagnos()!=null)
            this.lbDiagnosGroup.setText(pacient.getDiagnos().getGroupOfDiagnos().getCode());
        if (pacient.getTreatment() != null)
            this.lbTreatmentGroup.setText(pacient.getTreatment().getGroupOfTreatment().getCode());
        if (pacient.getBeddays()!=null)
            this.tbBedDays.setText(pacient.getBeddays().toString());
        if (pacient.getDaysBeforeTreatment()!=null)
            this.tbDaysBeforeTretament.setText(pacient.getDaysBeforeTreatment().toString());
        this.tbFIO.setText(pacient.getFio());
        if (pacient.getDateOfEntry()==null) pacient.setDateOfEntry(new Date());
    }

    private void AddActions()
    {
        tbFIO.addFocusListener(new FocusListener() {

            public void focusGained(FocusEvent e) {}

            public void focusLost(FocusEvent e) {
                pacient.setFio(tbFIO.getText());
            }
        });

        tbDaysBeforeTretament.addFocusListener(new FocusListener() {

            public void focusGained(FocusEvent e) {}

            public void focusLost(FocusEvent e) {
                if (tbDaysBeforeTretament.getText()!=null)
                    pacient.setDaysBeforeTreatment(Integer.parseInt(tbDaysBeforeTretament.getText()));
            }
        });

        tbBedDays.addFocusListener(new FocusListener() {

            public void focusGained(FocusEvent e) {}

            public void focusLost(FocusEvent e) {
                if (tbBedDays.getText()!=null)
                    pacient.setBeddays(Integer.parseInt(tbBedDays.getText()));
            }
        });

        cbDiagnos.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                pacient.setDiagnos((Diagnos)cbDiagnos.getModel().getSelectedItem());
                if (pacient.getDiagnos()!=null)
                    lbDiagnosGroup.setText(pacient.getDiagnos().getGroupOfDiagnos().getCode());
            }
        });

        cbWard.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                pacient.setWard((Ward)cbWard.getModel().getSelectedItem());
            }
        });

        cbWard.addItemListener(new ItemListener() {

            public void itemStateChanged(ItemEvent e) {
                pacient.setWard((Ward)cbWard.getModel().getSelectedItem());
            }
        });

        
        cbMoveFrom.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                pacient.setMoveFrom((Ward)cbMoveFrom.getModel().getSelectedItem());
            }
        });

        cbMoveTo.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                pacient.setMoveTo((Ward)cbMoveTo.getModel().getSelectedItem());
            }
        });

        cbTreatment.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                pacient.setTreatment((Treatment)cbTreatment.getModel().getSelectedItem());
                if (pacient.getTreatment()!=null) {
                    lbTreatmentGroup.setText("("+pacient.getTreatment().getGroupOfTreatment().getCode()+". "+
                            pacient.getTreatment().getGroupOfTreatment().getName().substring(0, 5)+"...)");
                    lbTreatmentGroup.setToolTipText(pacient.getTreatment().getGroupOfTreatment().getName());
                }
            }
        });

       chbComplex.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                pacient.setComplex(chbComplex.isSelected());
            }
        });

        chbDied.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                pacient.setDied(chbDied.isSelected());
            }
        });

        chDateComing.addCommitListener(new CommitListener() {

            public void onCommit(CommitEvent evt) {
                pacient.setDateOfComing(chDateComing.getCurrent().getTime());
                if ((pacient.getDateOfComing()!=null)&&(pacient.getDateOfDischarge()!=null))
                    lbBedDays.setText(Utils.getDays(pacient.getDateOfComing(), pacient.getDateOfDischarge()).toString());
            }
        });

        chDateDischarge.addCommitListener(new CommitListener() {

            public void onCommit(CommitEvent evt) {
                pacient.setDateOfDischarge(chDateDischarge.getCurrent().getTime());
                if ((pacient.getDateOfComing()!=null)&&(pacient.getDateOfDischarge()!=null))
                    lbBedDays.setText(Utils.getDays(pacient.getDateOfComing(), pacient.getDateOfDischarge()).toString());
            }
        });

        jAddWardBtn.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                Controller.getInstance().addWard();
            }
        });

        jAddDiagnosBtn.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                Controller.getInstance().addDiagnos();
            }
        });

        jAddTreatmentBtn.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                Controller.getInstance().addTreatment();
            }
        });
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        cbWard = new JComboBox(new CBModel(Maps.getWardList()));
        jLabel1 = new javax.swing.JLabel();
        tbFIO = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        cbDiagnos = new JComboBox(new CBModel(Maps.getDiagnosList()));
        jLabel5 = new javax.swing.JLabel();
        tbBedDays = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        lbBedDays = new javax.swing.JLabel();
        cbTreatment = new JComboBox(new CBModel(Maps.getTreatmentList()));
        jLabel8 = new javax.swing.JLabel();
        lbDiagnosGroup = new javax.swing.JLabel();
        lbTreatmentGroup = new javax.swing.JLabel();
        tbDaysBeforeTretament = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        cbMoveFrom = new JComboBox(new CBModel(Maps.getWardList()));
        jLabel12 = new javax.swing.JLabel();
        cbMoveTo = new JComboBox(new CBModel(Maps.getWardList()));
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        chbDied = new javax.swing.JCheckBox();
        chbComplex = new javax.swing.JCheckBox();
        jLabel15 = new javax.swing.JLabel();
        jAddWardBtn = new javax.swing.JButton();
        jAddTreatmentBtn = new javax.swing.JButton();
        jAddDiagnosBtn = new javax.swing.JButton();
        chDateComing = new datechooser.beans.DateChooserCombo();
        chDateDischarge = new datechooser.beans.DateChooserCombo();

        jLabel2.setText("Дата поступления");

        jLabel3.setText("Дата выписки");

        jLabel1.setText("Отделение");

        jLabel4.setText("ФИО");

        jLabel5.setText("Диагноз");

        jLabel6.setText("Койко-дни");

        lbBedDays.setText("(0)");

        jLabel8.setText("Вид лечения");

        lbDiagnosGroup.setText("(группа)");

        lbTreatmentGroup.setText("(группа)");

        jLabel11.setText("К/д до начала лечения");

        jLabel12.setText("Переведен из");

        jLabel13.setText("Переведен в");

        jLabel14.setText("Умер");

        chbDied.setMargin(new java.awt.Insets(0, 0, 0, 0));

        chbComplex.setMargin(new java.awt.Insets(0, 0, 0, 0));

        jLabel15.setText("Комплексное лечение");

        jAddWardBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ru/vsu/cs/piit/vokod/resources/add.gif"))); // NOI18N

        jAddTreatmentBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ru/vsu/cs/piit/vokod/resources/add.gif"))); // NOI18N

        jAddDiagnosBtn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ru/vsu/cs/piit/vokod/resources/add.gif"))); // NOI18N

        chDateComing.setBehavior(datechooser.model.multiple.MultyModelBehavior.SELECT_SINGLE);
        chDateComing.setCurrentNavigateIndex(0);
        chDateComing.setNothingAllowed(false);

        chDateDischarge.setBehavior(datechooser.model.multiple.MultyModelBehavior.SELECT_SINGLE);
        chDateDischarge.setCurrentNavigateIndex(0);
        chDateDischarge.setNothingAllowed(false);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(jLabel6)
                    .addComponent(jLabel8)
                    .addComponent(jLabel1)
                    .addComponent(jLabel4)
                    .addComponent(jLabel5)
                    .addComponent(jLabel15)
                    .addComponent(jLabel11)
                    .addComponent(jLabel12)
                    .addComponent(jLabel13)
                    .addComponent(jLabel14)
                    .addComponent(jLabel2))
                .addGap(7, 7, 7)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cbMoveTo, javax.swing.GroupLayout.Alignment.TRAILING, 0, 231, Short.MAX_VALUE)
                    .addComponent(cbMoveFrom, javax.swing.GroupLayout.Alignment.TRAILING, 0, 231, Short.MAX_VALUE)
                    .addComponent(tbDaysBeforeTretament, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 231, Short.MAX_VALUE)
                    .addComponent(chbDied, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(chbComplex)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(cbTreatment, 0, 162, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lbTreatmentGroup)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jAddTreatmentBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(tbBedDays, javax.swing.GroupLayout.DEFAULT_SIZE, 207, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(lbBedDays))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(cbWard, 0, 207, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jAddWardBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(cbDiagnos, 0, 150, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(lbDiagnosGroup)
                        .addGap(10, 10, 10)
                        .addComponent(jAddDiagnosBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(tbFIO, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 231, Short.MAX_VALUE)
                    .addComponent(chDateComing, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 231, Short.MAX_VALUE)
                    .addComponent(chDateDischarge, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 231, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tbFIO, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cbDiagnos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel5)
                            .addComponent(lbDiagnosGroup))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(cbWard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jAddDiagnosBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jAddWardBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(chDateComing, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(chDateDischarge, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tbBedDays, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6)
                    .addComponent(lbBedDays))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cbTreatment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8)
                            .addComponent(lbTreatmentGroup))
                        .addGap(6, 6, 6)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(chbComplex)
                            .addComponent(jLabel15)))
                    .addComponent(jAddTreatmentBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tbDaysBeforeTretament, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cbMoveFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(cbMoveTo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel14)
                    .addComponent(chbDied))
                .addContainerGap(20, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox cbDiagnos;
    private javax.swing.JComboBox cbMoveFrom;
    private javax.swing.JComboBox cbMoveTo;
    private javax.swing.JComboBox cbTreatment;
    private javax.swing.JComboBox cbWard;
    private datechooser.beans.DateChooserCombo chDateComing;
    private datechooser.beans.DateChooserCombo chDateDischarge;
    private javax.swing.JCheckBox chbComplex;
    private javax.swing.JCheckBox chbDied;
    private javax.swing.JButton jAddDiagnosBtn;
    private javax.swing.JButton jAddTreatmentBtn;
    private javax.swing.JButton jAddWardBtn;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel lbBedDays;
    private javax.swing.JLabel lbDiagnosGroup;
    private javax.swing.JLabel lbTreatmentGroup;
    private javax.swing.JTextField tbBedDays;
    private javax.swing.JTextField tbDaysBeforeTretament;
    private javax.swing.JTextField tbFIO;
    // End of variables declaration//GEN-END:variables

    public Pacient getPacient()
    {
        return pacient;
    }

}
